﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Should;
using mesan.ansatte.repository.repositories;

namespace mesan.ansatte.respository.unittests
{
	[TestClass]
	public class AnsattRepositoryTest
	{
	    private AnsattRepository _ansattRepo;

	    [TestInitialize]
        public void Init()
        {
            _ansattRepo = new AnsattRepository();            
        }

		[TestMethod]
		public void GetAll_WhenTableHasData_ShouldReturnListOf_Ansatt()
		{
			// Act
			var result = _ansattRepo.GetAll();

			// Assert
			result.ShouldNotBeEmpty();
		}

        
        [TestMethod]
        public void GetById_WhenIdDoesNotExist_ShouldReturn_Null()
        {
            // Act
            var result = _ansattRepo.GetById("NonexistentId");

            // Assert
            result.ShouldBeNull();
        }

        [TestMethod]
        public void GetById_WhenIdDoesExist_ShouldReturn_Ansatt()
        {
            // Act
            var result = _ansattRepo.GetById("1");

            // Assert
            result.ShouldNotBeNull();
        }
	}
}
